
#include "comm.h"
#define _SIZE 1024
int main()
{
    int r1 = mkfifo(FIFO_FILE, 0664);
    if (r1 < 0)
    {
        perror("mkfifo");
        exit(1);
    }
    int fd = open(FIFO_FILE, O_RDONLY);
    if (fd < 0)
    {
        perror("open");
        exit(2);
    }
    while(1)
    {
        char str1[_SIZE] = {"\0"};
        read(fd, str1, sizeof(str1));
        str1[sizeof(str1)] = '\0';
        write(1, str1, sizeof(str1));
        sleep(1);
    }
   
    close(fd);
    int r2 = unlink(FIFO_FILE);
    if (r2 < 0)
    {
        perror("unlink");
        exit(3);
    }
    return 0;
}